<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="db.Message" %>
<%@ page import="debug.*" %>
<%
	Dbg.print(request);
	ArrayList<Message> list =
				(ArrayList<Message>)request.getAttribute("list");
	int max = (Integer)request.getAttribute("max");
	//	日時表示の編集（準備）
    SimpleDateFormat sdf = 
    	new SimpleDateFormat("yyyy/MM/dd");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="css/style.css" type="text/css" />
		<link rel="stylesheet" href="css/list.css" type="text/css" />
		<title>メッセージ一覧</title>
	</head>
	<body>
		<a href="entry.jsp" class="button small">投稿</a>
		<% for ( int i=0 ; i<list.size() ; i++ ) { %>
		<% 		Message m = list.get( i ); %>
		<p>
			<div class="delete">
				<a href="EditServlet?id=<%= m.getId() %>">修正</a>
			</div>
			<div class="account">
				<%= m.getAccount() %>
			</div>
			<div class="message">
				<%= m.getMessage().replaceAll("\n", "<br />") %>
			</div>
			<div class="user_agent">
				<%= m.getUser_agent() %>
			</div>
			<div class="regist_at">
				<%= m.getRegist_at() %>
			</div>
		</p>
		<hr />
		<% } %>
		<%
		int s = 0;
		while (s < max ) {
			out.print("<a href='ListServlet?start=" + s +"'>");
			out.print(1+ s/5);
			out.println("</a>&nbsp;");
			s += 5;
		}
		%>
	</body>
</html>